package com.itheima.neicuntu;

public class Test {
    public static void main(String[] args) {
        Student cai = new Student();
        cai.setName("蔡徐坤");
        cai.setAge(30);
        cai.setScore(100);
        System.out.println(cai);
        Student huang = new Student("黄子韬", 28, 99);
        System.out.println(huang);
    }
}

class Person{
    private String name;
    private int  age;

    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

class Student extends Person{
    private int score;
    //无参 选父类无参
    public Student() {
    }
    //有参 选父类的有参
    public Student(String name, int age, int score) {
        super(name, age);
        this.score = score;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name=" + getName() +
                "age=" + getAge() +
                "score=" + score +
                '}';
    }
}